<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:gb="http://giava.by/giavacms/base"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	template="/WEB-INF/layout/t.xhtml">
	<ui:define name="title">
		<h:outputText value="Lista Pagine" />
	</ui:define>
	<ui:define name="roles">
		<f:attribute name="roles" value="resource" />
	</ui:define>
	<ui:define name="content">
		<h:form id="central">
			<center>
				<p:panel header="Lista Pagine">
					<h:panelGrid columns="5" rendered="true">
						<h:outputLabel for="nome" value="Nome:" />
						<h:inputText id="nome" value="#{pageController.search.obj.title}" />

						<h:outputLabel for="staticita" value="Tipo di contenuto: " />
						<h:selectOneMenu id="staticita"
							value="#{pageController.search.obj.template.template.searchStatico}">
							<f:selectItems value="#{staticoDinamicoItems}" />
						</h:selectOneMenu>
						<p:commandButton action="#{pageController.reloadAjax}"
							value="Cerca" ajax="true" immediate="false" update="pagesList" />
					</h:panelGrid>
					<br />

					<p:dataTable id="pagesList" rowIndexVar="rowIndex" var="p"
						value="#{pageController.model}" rows="#{pageController.pageSize}"
						paginator="true" dynamic="true">
						<p:column width="50">
							<center>
								<h:outputText value="#{rowIndex+1} " />
							</center>
						</p:column>
						<p:column width="150">
							<f:facet name="header">
							titolo
						</f:facet>
							<h:outputText value="#{p.title}" />
						</p:column>
						<p:column width="350">
							<f:facet name="header">
							descrizione
						</f:facet>
							<h:outputText value="#{p.description}" />
						</p:column>
						<p:column width="60">
							<f:facet name="header">
							contenuto
						</f:facet>
							<h:outputText value="statico"
								rendered="#{p.template.template.statico}" />
							<h:outputText value="dinamico"
								rendered="#{not p.template.template.statico}" />
						</p:column>
						<p:column width="150">
							<center>
								<h:commandLink value="modifica"
									action="#{pageController.modElement}" />
								-
								<h:outputLink target="_blank"
									value="#{request.contextPath}/p/#{p.id}">
									<h:outputText value="anteprima" />
								</h:outputLink>
								-
								<h:commandLink value="clona"
									action="#{pageController.cloneElement}" />

							</center>
						</p:column>
					</p:dataTable>
				</p:panel>
				<br /> <br />
				<h:panelGrid columns="3">
					<h:commandButton action="#{pageController.addPaginaStatica}"
						value="Aggiungi pagina con contenuto statico" />
					<h:commandButton action="#{pageController.addPaginaDinamica}"
						value="Aggiungi pagina con contenuto dinamico" />
					<h:commandButton action="#{pageController.backPage}"
						value="Indietro" rendered="false" />
				</h:panelGrid>
			</center>
		</h:form>

	</ui:define>
</ui:composition>